package com.taobao.txc.resourcemanager.a.c;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.c.e;
import com.taobao.txc.parser.b.a.g;
import com.taobao.txc.resourcemanager.a.a.c;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;

public class a<T>
  implements c<T>
{
  private static final LoggerWrap a = LoggerInit.logger;
  private final com.taobao.txc.resourcemanager.b.a.d b;
  private final com.taobao.txc.resourcemanager.b.a.a c;
  private final com.taobao.txc.resourcemanager.b.b.a.a<T> d;
  
  public a(com.taobao.txc.resourcemanager.b.a.a parama, com.taobao.txc.resourcemanager.b.a.d paramd, com.taobao.txc.resourcemanager.b.b.a.a<T> parama1)
  {
    this.b = paramd;
    this.c = parama;
    this.d = parama1;
    a.info(String.format("%s", new Object[] { paramd.g() }));
  }
  
  public String a()
  {
    if ((this.b instanceof com.taobao.txc.resourcemanager.b.c.d))
    {
      com.taobao.txc.resourcemanager.b.c.d locald = (com.taobao.txc.resourcemanager.b.c.d)this.b;
      g localg = com.taobao.txc.parser.b.b.b(locald.g());
      localg.a(this.b);
      return localg.k();
    }
    return this.b.g();
  }
  
  public static void a(String paramString1, long paramLong, String paramString2, String paramString3)
  {
    if (paramString3 == null) {
      return;
    }
    a.info(String.format("RtExecutor retry %s:%d %s", new Object[] { paramString1, Long.valueOf(paramLong), paramString3 }));
    try
    {
      DataSource localDataSource = com.taobao.txc.resourcemanager.b.b.a(paramString2).a();
      localObject = new JdbcTemplate(localDataSource);
      ((JdbcTemplate)localObject).execute(paramString3);
    }
    catch (DataAccessException localDataAccessException)
    {
      Object localObject = (SQLException)localDataAccessException.getCause();
      if (((SQLException)localObject).getErrorCode() == 1062) {
        a.info("RtExecutor retry sql:" + localDataAccessException.getMessage() + ":" + paramString3);
      } else {
        throw ((Throwable)localObject);
      }
    }
  }
  
  public T a(Object... paramVarArgs)
  {
    Object localObject = this.d.b(0);
    try
    {
      localObject = this.d.b(this.b.f(), paramVarArgs);
    }
    catch (SQLException localSQLException)
    {
      String str = a();
      e locale = com.taobao.txc.resourcemanager.d.a.i().a(this.c.a(), str);
      if (locale == null)
      {
        a.a(com.taobao.txc.common.b.b.S.bd, localSQLException.getMessage(), localSQLException);
        throw localSQLException;
      }
    }
    return localObject;
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.resourcemanager.a.c.a
 * JD-Core Version:    0.7.0.1
 */